package com.tanhua.server.controller;




import com.tanhua.model.vo.SoundVo;
import com.tanhua.server.service.PeachblossomService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.RequestEntity;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

@RestController
@RequestMapping("/peachblossom")
public class PeachblossomController {

    @Autowired
    private PeachblossomService peachblossomService;

    /**
     * 桃花传音-发送语音
     * @param soundFile 语音文件
     * @return
     */
    @PostMapping
    public ResponseEntity sendSounds(@RequestBody MultipartFile soundFile){
        peachblossomService.sendSounds(soundFile);
        return ResponseEntity.ok(null);

    }
    /**
     * 桃花传音-接收语音
     * @return
     */
    @GetMapping
    public ResponseEntity getSounds(){
       SoundVo soundVo= peachblossomService.getSounds();
        return ResponseEntity.ok(soundVo);

    }
}
